package com.ruoyi.system.utils;

import java.util.Calendar;
import java.util.Date;

/**MaNongXF
 * 判断时间是否处于某个时间段内
 *
 * @param time 需要比较的时间
 * @param from 起始时间
 * @param to 结束时间
 * @return
 */

public class determineTime {
    public static boolean belongCalendar(Date timeDate, Date fromDate, Date toDate) {
        Calendar date = Calendar.getInstance();
        date.setTime(timeDate);             //输入时间
        Calendar after = Calendar.getInstance();
        after.setTime(fromDate);            //比较的开始时间
        Calendar before = Calendar.getInstance();
        before.setTime(toDate);              //比较的结束时间
        if (date.after(after) && date.before(before)) {
            return true;
        } else {
            return false;
        }
    }

    }
